function debounce(callback, wait) {
	let timer;
	return function (e) {
		if (timer) clearTimeout(timer);
		timer = setTimeout(() => {
			callback.call(this, e);
			timer = null;
		}, wait);
	}
}
